package com.oracle.web;

import com.oracle.beans.CheckItem;
import com.oracle.beans.PageBean;
import com.oracle.beans.QueryPageVo;
import com.oracle.beans.ResultInfo;
import com.oracle.service.CheckItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("checkItem")
@Api(value = "检查项Controller")
public class CheckItmeController {
    @Autowired
    CheckItemService checkItemService;

    @GetMapping("findList")
    @ApiOperation(value = "分页查询检查项目")
    public PageBean<CheckItem> findList( QueryPageVo vo){
        PageBean<CheckItem> pageBean = checkItemService.findList(vo);
        return pageBean;
    }

    @GetMapping("findAll")
    @ApiOperation(value = "查询所有检查项")
    public ResultInfo findAll(){
        ResultInfo resultInfo=checkItemService.findAll();
        return resultInfo;
    }

    @PostMapping("add")
    @ApiOperation(value = "添加检查项目")
    public ResultInfo add(@RequestBody CheckItem checkItem){
        ResultInfo resultInfo=checkItemService.add(checkItem);
        return resultInfo;
    }

    @PutMapping("update")
    @ApiOperation(value = "修改检查项目")
    public ResultInfo update(@RequestBody CheckItem checkItem){
        ResultInfo resultInfo=checkItemService.update(checkItem);
        return resultInfo;
    }

    @DeleteMapping("delete/{id}")
    @ApiOperation(value = "删除检查项目")
    public ResultInfo delete(@PathVariable("id")Integer id){
        ResultInfo resultInfo=checkItemService.dalete(id);
        return resultInfo;
    }

}
